var e = require("../../../@babel/runtime/helpers/defineProperty"), t = getApp(), a = require("../../../mybehaviors/location/location");

Component({
    behaviors: [ a ],
    properties: {
        datas: {
            type: null
        },
        component_id: {
            type: null
        }
    },
    data: {
        activeID: 0,
        deliverInfo: {
            deliver_name: "正在获取中...",
            loading: !0
        }
    },
    lifetimes: {
        attached: function() {
            this.initData();
        },
        moved: function() {},
        detached: function() {}
    },
    pageLifetimes: {
        show: function() {
            this.initData();
        },
        hide: function() {},
        resize: function(e) {}
    },
    methods: {
        gotoUrl: function() {
            this.data.deliverInfo.loading || wx.navigateTo({
                url: "/packageC/selfCarry/selectSelfPickupPoint/selectSelfPickupPoint?tag=1"
            });
        },
        initData: function() {
            var e = this, t = null;
            try {
                t = wx.getStorageSync("deliverId");
            } catch (e) {}
            t && (this.data.activeID = t), this._getLocation(function() {
                e.getNowPackageDeliver();
            });
        },
        getNowPackageDeliver: function(a, i) {
            var n = this, o = {
                lng: this.data.point.lng || "",
                lat: this.data.point.lat || ""
            };
            this.data.activeID && (o.deliver_id = this.data.activeID);
            var l = t.getNetAddresss("plugin.package-deliver.frontend.decorate-deliver.getNowPackageDeliver");
            t._postNetWork({
                url: l,
                data: o,
                success: function(t) {
                    var a = t.data;
                    1 == a.result ? (n.setData({
                        deliverInfo: a.data,
                        total_page: a.data.last_page
                    }), wx.setStorageSync("deliverId", a.data.id)) : (wx.showToast({
                        title: a.msg,
                        duration: 1e3,
                        icon: "none"
                    }), n.setData(e({}, "deliverInfo.deliver_name", "请手动切换选择！"))), n.setData(e({}, "deliverInfo.loading", !1));
                },
                fail: function(e) {
                    console.log(e.msg);
                }
            });
        }
    }
});